﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BLL;
using Model;
namespace UI
{
    public partial class Frm添加会员 : Form
    {
        public Frm添加会员()
        {
            InitializeComponent();
        }

        private void Frm添加会员_Load(object sender, EventArgs e)
        {
           DataSet ds= BLLCHAallhy.BLLchahuiyuandengji();
           this.cbbdengji.DataSource = ds.Tables[0];
           this.cbbdengji.ValueMember = "VGID";//隐藏列
           this.cbbdengji.DisplayMember = "VGName";

            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Model_Vips.VipName = txtxingming.Text;
            Model_Vips.VipTel = txtdianhua.Text;
            Model_Vips.GradeID = cbbdengji.SelectedValue.ToString();

            if(radnan.Checked){
                Model_Vips.VipSex = radnan.Text;
            }
            if (radnv.Checked)
            {
                 Model_Vips.VipSex =radnv.Text;
            }
            Model_Vips.VipEndDate = DateTime.Parse( dateTimePicker1.Text);
           int a= BLLCHAallhy.TJvip();
           if (a>0)
           {
               MessageBox.Show("添加成功");
               FrmHuiyuanguanli f = new FrmHuiyuanguanli();
               f.Show();
               this.Close();
           }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void Frm添加会员_FormClosing(object sender, FormClosingEventArgs e)
        {
            e.Cancel = false;
            FrmHuiyuanguanli f = new FrmHuiyuanguanli();
            f.Show();
        }
    }
}
